package com.qiudaoyu.test;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.view.View;

import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;

import com.qiudaoyu.service.DataParcelable;
import com.qiudaoyu.service.LocalService;
import com.qiudaoyu.service.RemoteService;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, SecondActivity.class));
            }
        });


        findViewById(R.id.startlocal).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });

        findViewById(R.id.startremote).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, RemoteService.class);
                intent.putExtra("abc", new DataParcelable());
                startService(intent);

            }
        });

        findViewById(R.id.startlocal).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, RemoteService.class);
                intent.putExtra("abc", new DataParcelable());
                bindService(intent, new ServiceConnection() {
                    @Override
                    public void onServiceConnected(ComponentName name, IBinder service) {


                    }

                    @Override
                    public void onServiceDisconnected(ComponentName name) {


                    }
                }, BIND_AUTO_CREATE);


            }
        });


        int ii = 0;
        switch (ii) {
            case 0:
                return;
            case 1:
                return;
            case 2:
                return;
            case 3:
                return;
        }

    }

}
